<extend name="Public/base" />

<block name="body">
  <div class="main-title">
    <h2>{$data['id']?'编辑':'新增'}秒杀活动</h2>
  </div>

  <form action="{:U('update')}" enctype="application/x-www-form-urlencoded" method="POST" class="form-horizontal">
    <div class="form-item">
      <label for="auth-title" class="item-label">秒杀活动名称</label>
      <div class="controls">
        <input id="auth-title" type="text" name="name" class="text input-large" value="{$data.name}"/>
      </div>
    </div>


    <div class="form-item">
      <label for="auth-title" class="item-label">活动时间</label>
      <div class="controls">
        <input type="text" name="start_time" class="text date_select" value="{:time_format($data['start_time'], 'Y-m-d H:i:s')}" placeholder="开始时间"/>
        至
        <input type="text" name="expire_time" class="text date_select" value="{:$data['expire_time'] ? time_format($data['expire_time'], 'Y-m-d H:i:s') : null}" placeholder="结束时间"/>
      </div>
    </div>


<!--    <div class="form-item">
      <label for="auth-title" class="item-label">活动店铺限数</label>
      <div class="controls">
        <input type="text" name="store_amount" class="text input-small" value="" placeholder="">

      </div>
    </div>-->

      <div class="form-item cf">
          <php>$blabla = explode(',' ,$data['store_grade']);</php>
          <label class="item-label">店铺报名等级<span class="check-tips">（报名活动的店铺等级限制）</span></label>
          <volist name ="store_grade" id="vo">
          <div class="controls" id="J_itemCategory">
              <p><input type="checkbox" id="store_grade"  name="store_grade[]" value="{$vo.id}" <if condition="in_array($vo.id , $blabla)">checked</if> />{$vo.name}</p>
          </div>
          </volist>
      </div>


<!--
    <div class="form-item cf">
   <php>$blabla = explode(',' ,$data['store_grade']);</php>
      <label class="item-label">店铺报名等级<span class="check-tips">（报名活动的店铺等级限制）</span></label>
      <div class="controls" id="J_itemCategory">
        <p><input type="checkbox" id="store_grade"  name="store_grade[]" value="1" <if condition="in_array(1 , $blabla)">checked</if> />钻石店铺</p>
        <p><input type="checkbox" name="store_grade[]" value="2" <if condition="in_array(2 , $blabla)">checked</if> />白金店铺</p>
        <p><input type="checkbox" name="store_grade[]" value="3" <if condition="in_array(3 , $blabla)">checked</if> />普通店铺</p>
      </div>
    </div>-->

      <div class="form-item">
      <label for="auth-title"  class="item-label">可上传最大商品数</label>
      <div class="controls">
          <input  type="text" name="item_num" class="text input-large" value="{$data.item_num}"  onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"/>
      </div>
      </div>

    <div class="form-item">
      <label class="item-label">活动规则<span class="check-tips"></span></label>
      <div class="controls">
        <textarea name="rule"   style="width:500px;height:150px">{$data.rule}</textarea>
      </div>
      </div>
    <div class="form-item">
      <input type="hidden" name="id" value="{$data.id}" />
      <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
      <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
    </div>
  </form>
<block>

  <block name="script">
    <script language="javascript" type="text/javascript" src="__PUBLIC__/Admin/js/My97Date/WdatePicker.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(function(){
            //导航高亮
            highlight_subnav('{:U('index')}');
            //时间选择
            $('.date_select').focus(function(){
                WdatePicker({skin: 'twoer', dateFmt: 'yyyy-MM-dd HH:mm:ss'});
            });
        });
    </script>
  </block>
